cmake_minimum_required(VERSION 3.10)
project(torchtest VERSION 1.0.0 LANGUAGES CXX)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(0configs.cmake)

# 设置头文件搜索路径
include_directories(include)

set(my_EXE ${PROJECT_NAME})
# 添加可执行文件
add_executable(${my_EXE}
    src/main.cpp

    include/common.h
    # include/test_runner.h

    src/tests/tensor_operations.cpp
    src/tests/autograd_examples.cpp
    src/tests/neural_network.cpp
    src/tests/custom_operators.cpp
)

# 链接 PyTorch
target_link_libraries(${my_EXE}
    PRIVATE
        torch
        # OpenMP_CXX
)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${my_EXE})

##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 安装目标（可选）
install(TARGETS ${my_EXE} DESTINATION bin)
